package com.gongj.jedis.fbsLock;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/**
 * @program: jedis
 * @description:
 * @author: gongj
 * @Description: TODO
 * @create: 2020-07-11 17:40
 **/
public class JedisPoolTest {
    public static void main(String[] args) {
        Jedis pool = JedisPoolTest.pool();
        System.out.println(pool.get("2020711"));
        pool.close();
    }

    public static Jedis pool(){
        JedisPoolConfig config = new JedisPoolConfig();
        // 最大连接数
        config.setMaxTotal(10);
        // 最大连接空闲数
        config.setMaxIdle(2);
        JedisPool jedisPool = new JedisPool(config, "47.105.198.54", 6379,10000,"yj19980402");
        try{
           return jedisPool.getResource();
        }catch(Exception e){
            e.printStackTrace();
            return null;
        }
    }

}
